package com.word.android.sdk;

import android.app.Activity;
import android.content.Context;

import com.word.android.sdk.bridge.WordCocosBridge;
import com.word.android.sdk.ad.WordKwaiReward;


public class WordBusiness {

    public static Context context;
    public static final String GAME_MAIN_CLS = "org.cocos2dx.javascript.AppActivity";
//    private static final String GAME_MAIN_CLS = "com.test.app.GameActivity";

    public static void init(Context ctx) {
        try {
            context = ctx.getApplicationContext();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void onActivityCreate(Activity activity) {
        try {
            if (activity.getClass().getName().equals(GAME_MAIN_CLS)) {
                WordCocosBridge.getInstance().setMainGameActivity(activity);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void onActivityDestroyed(Activity activity) {
        try{
            if (activity.getClass().getName().equals(GAME_MAIN_CLS)) {
                WordKwaiReward.getInstance().onDestroy();
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
